package leetcode.秋招.网易互娱;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.Map;
import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/9/17 20:27
 * @description：
 */
public class Main3 {
    static int max;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String next = in.next();
        Object jsonObject = JSONObject.parse(next);
        JSONObject object = (JSONObject) jsonObject;
        getDeep(object, 0);
        System.out.println(max);

    }

    public static int getDeep(JSONObject object, int deepLevel) {
        if (object == null) {
            return max = 0;
        }
        deepLevel = deepLevel + 1;
        for (Map.Entry entry : object.entrySet()) {
            Object obj = object.get(entry.getKey());
            if (obj instanceof JSONObject) {
                JSONObject object1 = (JSONObject) obj;
                getDeep(object1, deepLevel);
            }
            if (obj instanceof JSONArray) {
                JSONArray jsonArray = (JSONArray) obj;
                for (int i = 0; i < jsonArray.size(); i++) {
                    getDeep((JSONObject) (jsonArray.get(0)), deepLevel);
                }
            }
        }
        if (max <= deepLevel) {
            max = deepLevel;
        }
        return max + 1;
    }
}
